package com.mk.shardingjdbcdemo.entity;

import lombok.Data;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;

@Data
@Entity
@Table(name = "t_order_item")
public class OrderItem implements Serializable {

    private static final long serialVersionUID = 9120155802358880931L;

    /**
     * 订单id，注意由于sharding没有主外键映射的配置，所在要将主外键的字段设置为一致，才能自动适配
     */
    @Id
    private Long orderId;

    /**
     * 数量
     */
    private BigDecimal num;

    /**
     * 单价
     */
    private BigDecimal price;

    private Long typeId;
}
